using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class DatabaseToolbar : System.Web.UI.UserControl
{
    private string _selectedValue = string.Empty;

    public string SelectedValue
    {
        get
        {
            return _selectedValue;
        }
        set
        {
            _selectedValue = value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string databaseName = HttpUtility.UrlEncode(Request.QueryString["database"]);

            hypQuery.NavigateUrl = "~/Administration/QueryDatabase.aspx?database=" + databaseName;
            hypTables.NavigateUrl = "~/Administration/Tables.aspx?database=" + databaseName;


            hypProperties.NavigateUrl = "~/Administration/DatabaseProperties.aspx?database=" + databaseName;
            hypStoredProcedures.NavigateUrl = "~/Administration/StoredProcedures.aspx?database=" + databaseName;

            switch (SelectedValue)
            {
                case "tables":
                    htcTables.Attributes["class"] = "selectedLink";
                    hypTables.Attributes.Remove("onMouseOver");
                    break;
                case "query":
                    htcQuery.Attributes["class"] = "selectedLink";
                    hypQuery.Attributes.Remove("onMouseOver");
                    break;
                case "properties":
                    htcProperties.Attributes["class"] = "selectedLink";
                    hypProperties.Attributes.Remove("onMouseOver");
                    break;
                case "storedprocedures":
                    htcStoredProcedures.Attributes["class"] = "selectedLink";
                    hypStoredProcedures.Attributes.Remove("onMouseOver");
                    break;
            }
        }
    }
}
